JavaScript The Ultimate Beginners Guide Start Coding Today by 2016
Author: 2016 , Date: March 20, 2018
, Views: 257
You will be obtaining the same results from Chrome: I have assigned values in Chrome for myString1 because it returns an error that myString1 was not defined.
Notice that you can use the name of your string, but it must be specified in your repeat command. When I used:
res = string.repeat(5);
I obtained a return error because the string was not defined.
See next image:
Let’s try to define the string and see what happens.
Example:
var string = “Love can move mountains.”;
When you execute the command:
var res = string.repeat(5);
The‘Console’will execute it with the expected output–the string is repeated 5 times. See next image:
Copyright Disclaimer:
This site does not store any files on its server. We only index and link
to content provided by other sites. Please contact the content providers
to delete copyright contents if any and email us, we'll remove relevant
links or contents immediately.